<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/bootstrap3/bootstrap.autocomplete.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
<script src="/res/third/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/res/third/easyUI/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script type="text/javascript">
	function sosuo() {
		var lpath = location.pathname;
		$("#soform").attr("action", lpath + "?pageNo=" + 1);
		$("#soform").submit();
	}

    function mark(id) {
        dialog = art.dialog({
            title : "备注",
            lock : true,
            content : $("#mark_dialog").html(),
            ok: function () {
                var auditOpinion = $("#auditOpinion").val();
                $.post('/company/remark.do', { id: id, auditOpinion: auditOpinion }, function (data, textStatus, jqXHR) {
                        window.location.reload();
                    }
                );
            }
        });
    }
	
	 
   function dia(param){
	   dialog=art.dialog({
		   title:"审核意见",
		   width:400,
		   lock:true,
		   content:document.getElementById("create")

	   });
   }
	
	function operate(id){
		$("#id").val(id);
		dia("审核意见");
	}
	
	function agree(){
		var con=confirm("是否确认同意")
		if(con){
			$.ajax({
			      type:"post",
				  dataType:"json",
				  data:$("#creat").serialize(),
				  url:"/company/auditSign.do",
				  success:function(aj){
					  if(aj.success){
						  location.reload();//刷新页面
						  confirm(aj.msg);
					  }
				  }
			   });
		}
		
	}
	
	function refuse(){
		var conn=confirm("是否确认拒绝");
		if(conn){
			$.ajax({
			      type:"post",
				  dataType:"json",
				  data:$("#creat").serialize(),
				  url:"/company/auditSign1.do",
				  success:function(aj){
					  if(aj.success){
						  location.reload();//刷新页面
						  confirm(aj.msg);
					  }
				  }
			   });
		}
		
	}
	
	
</script>
<script type="text/html" id="mark_dialog">
	<div style="width: 400px;height: 150px;">
		<textarea id="auditOpinion" name="auditOpinion" style="width: 100%;height: 100px;"></textarea>
	</div>
</script>
<style type="text/css">
</style>

</head>

<body>
	<div class="panel panel-info panel-content">
		<div class="panel-heading">
			<button style="float: right" type="button" onclick="exportChecked()" class="btn btn-info">
				&nbsp;导出已选择的申请
			</button>

			<form id="soform" method="post">
				<table>
					<tr>
						<td class="w80" style="padding-top: 5px">
							<label for="identity" class="center-block">身份：</label>
						</td>
						<td class="w200 ">
							<select class="form-control" name="so_identity">
								<option value="">全部</option>
								[#list identityMap?keys as key]
									<option value="${key}" [#if so_identity??][#if key==so_identity]selected[/#if][/#if]>${identityMap[key]!}</option>
								[/#list]
							</select>
						</td>
						<td style="padding-left: 10px">
							<div class="input-group">
								<span class="input-group-btn">
									<button class="btn btn-default" type="button" onclick="sosuo()">搜索</button>
								</span>
							</div>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<table class="table table-hover table-bordered table-striped table-condensed">
			<thead>
				<tr>
					<th><input type="checkbox" id="checkAll" onclick="checkAll()"/></th>
					<th>公司名称</th>
					<th>申请身份</th>
					<th>签约金额</th>
					<th>申请时间</th>
					<th>联系人</th>
					<th>联系电话</th>
					<th>备注</th>
					<th>操作</th>
				</tr>
			</thead>
			[#list pagination.list as signapply ]
			<tr>
				<td align="center"><input type="checkbox" value="${signapply.id}" class="checkitem"/></td>
				<td align="center">${signapply.companyName!}</td>
				<td align="center">${identityMap[signapply.identity?string]!}</td>
				<td align="center">${signapply.purchaseAmount!}</td>
				<td align="center">${(signapply.createtime?string("yyyy-MM-dd HH:mm:ss"))!}</td>
				<td align="center">${signapply.contacter!}</td>
				<td align="center">${signapply.phone!}</td>
				<td align="center">
				    ${signapply.auditOpinion!}
				</td>
				<td align="center">
				   <input type="button" onclick="mark('${signapply.id!}')" id="operat" class="btn-info" value="备注">
				</td>
			</tr>
			[/#list]
		
		</table>
		<div class="panel-footer">[@fenye p = pagination form = 'infoForm' /]</div>
	</div>
	<form id="exportExcel" action="exportSignApplyExcel.do">
		<input type="hidden" name='ids'  id="ids" />
	</form>

</body>
</html>
<script type="text/javascript">
//全选方法

function checkAll(){
	var setchecked = false;
	if($("#checkAll").is(":checked")){
		setchecked=true;
	}
	$(".checkitem").each(function(){
		$(this)[0].checked =setchecked;
	})
}

function exportChecked(){
	var ids="";
	$(".checkitem").each(function(){
		if($(this)[0].checked){
			ids+= ($(this).val()+",");
		}
	})
	if(ids==""){
		alert("至少选择一条签约申请！")
	}else{
		ids = ids.substr(0,ids.length-1);
		$("#ids").val(ids);
		$("#exportExcel").submit();
	}
}
</script>

